//
//  TTOpenPlusPopView.m
//  TaoTuo
//
//  Created by admin on 2019/11/12.
//  Copyright © 2019 admin. All rights reserved.
//

#import "TTOpenPlusPopView.h"
#import <UIView+TYAlertView.h>

@interface TTOpenPlusPopView ()

@property (weak, nonatomic) IBOutlet UIView *oneView;
@property (weak, nonatomic) IBOutlet UIImageView *oneImageView;
@property (weak, nonatomic) IBOutlet UIView *twoView;
@property (weak, nonatomic) IBOutlet UIImageView *twoImageView;
@property (weak, nonatomic) IBOutlet UILabel *twoInfoLabel;

@property (nonatomic, copy) NSString *money;
@property (nonatomic, copy) NSString *year;

@end

@implementation TTOpenPlusPopView

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    NSString *str = @"原价￥1290/5年 限时优惠137.6/年";
    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str];
    [attr addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:[str rangeOfString:@"1290/5"]];
    [attr addAttribute:NSStrikethroughColorAttributeName value:UIColorHex(999999) range:[str rangeOfString:@"1290/5"]];
    
    self.twoInfoLabel.attributedText = attr;
    
    // 默认第一个
    self.twoImageView.image = [UIImage imageNamed:@"zifu_sel"];
    self.money = @"688";
    self.year = @"5";
}


// 点击第一个view
- (IBAction)oneViewTapActin:(UITapGestureRecognizer *)sender {
    
    self.oneImageView.image = [UIImage imageNamed:@"zifu_sel"];
    self.twoImageView.image = [UIImage imageNamed:@"address_unsel"];
    
    self.money = @"268";
    self.year = @"1";
}


// 点击第二个view
- (IBAction)twoViewTapAction:(id)sender {
    
    self.oneImageView.image = [UIImage imageNamed:@"address_unsel"];
    self.twoImageView.image = [UIImage imageNamed:@"zifu_sel"];
    
    self.money = @"688";
    self.year = @"5";
}

// 立即支付
- (IBAction)clickPayBtnAction:(UIButton *)sender {
    
    if (self.gotoPaymentBlock) {
        self.gotoPaymentBlock(self.money, self.year);
    }
    [self hideView];
}

@end
